package com.xdcplus.web.common.enums.mm;

/**
 * 领料退料申请单状态
 *
 * @Description
 * @Author xyy
 * @Date 2023/5/27 14:42
 */
public enum MmStockStateEnum {

    RUNNING("1", "执行中"),
    COMPLETE("2", "已完成"),

    ;

    MmStockStateEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsgByCode(String code) {
        for (MmStockStateEnum mmStockState : values()) {
            if (mmStockState.getCode().equals(code)) {
                return mmStockState.getMsg();
            }
        }
        return null;
    }

    public static String getCodeByQty(Long totalCount, Long updateCount) {
        if (totalCount.equals(updateCount)) {
            return MmStockStateEnum.COMPLETE.code;

        } else {
            return MmStockStateEnum.RUNNING.code;
        }
    }

    private String code;

    private String msg;

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
